<?php
namespace Admin\Controller;
use Think\Controller;
class publicController extends Controller {
	public function yzm(){
		$Verify =  new \Think\Verify();
		$Verify->fontSize = 30;
		$Verify->length   = 4;
		$Verify->useNoise = false;
		$Verify->entry();
	}
    public function login(){
        $this->display();
    }
	public function loginAction(){
		$name = $_POST["username"];
		$pass = $_POST["password"];
		$verify = new \Think\Verify();
		$panduan = $verify->check($_POST["yzm"]);
		$info = M("user")->where("name = '$name' and pass = '$pass'")->select();
		if(!empty($info) && $panduan){
			session('name',$name);  
			$this->redirect("Admin/index/index");
		}else{
			$this->redirect("Admin/Public/login");
		}
	}
	public function loginexit(){
		session('name',null); 
		$this->redirect("Admin/Public/login");
	}
}